/**
 * 
 */
package com.dingding.order.core.myorder.dao.impl;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.dingding.common.core.base.dao.impl.BaseDaoImpl;
import com.dingding.common.core.base.daox.IBaseDaoX;
import com.dingding.common.core.base.daox.ICriteriaBaseDao;
import com.dingding.common.core.base.daox.ISQLBaseDao;
import com.dingding.common.core.beans.UserLogin;
import com.dingding.common.core.beans.Userorder;
import com.dingding.common.core.beans.special.Userspecialorder;
import com.dingding.common.core.beans.special.UserspecialorderT;
import com.dingding.common.core.util.DateFormatUtil;
import com.dingding.common.core.util.ToolUtil;
import com.dingding.order.core.myorder.dao.IGetMyOrderDao;
import com.dingding.order.core.myorder.sql.MyOrderSQL;
import com.dingding.order.dto.myorder.MyOrder;
import com.dingding.order.dto.myorder.ReqHistoryOrderDTO;
import com.dingding.order.dto.myorder.ReqHistoryOrderDetailDTO;
import com.dingding.order.dto.myorder.ReqMyOrderDTO;
import com.dingding.order.dto.myorder.ResHistoryOrderDTO;
import com.dingding.order.dto.myorder.ResHistoryOrderDetailDTO;
import com.dingding.order.dto.myorder.SpeCusOrdInfoResult;
import com.dingding.order.dto.myorder.UserTakeInformation;

/**
 * @ClassName: GetMyOrderDaoImpl
 * @Description:获得我的订单Dao实现
 * @author zhouxuan
 * @date 2016年7月5日 上午10:50:55
 * @since V2.3.0
 */
@Component("getMyOrderDao")
public class GetMyOrderDaoImpl extends BaseDaoImpl<Userorder> implements IGetMyOrderDao {

	@Resource(name = "SQLBaseDao")
	private ISQLBaseDao sqlBaseDao;

	@Resource(name = "criteriaBaseDao")
	private ICriteriaBaseDao criteriaBaseDao;

	@Resource(name = "baseDaoX")
	private IBaseDaoX baseDaoX;

	private Logger log = Logger.getLogger(this.getClass());

	/**
	 * @Title: getUserTakeImformation
	 * @Description:获取用户搭乘接乘信息
	 * @author zhouxuan
	 * @since V2.3.0
	 */
	@Transactional(readOnly = true)
	public UserTakeInformation getUserTakeImformation(String userId) {

		// 从数据库获取用户接乘搭乘信息
		Object[] userTakeObjects = getUserTakeImformationFromDB(userId);
		// 转换bean
		UserTakeInformation userTakeInformation = convertUserTakeInformation(userTakeObjects);

		return userTakeInformation;

	}

	/**
	 * @Title: convertUserTakeInformation
	 * @Description:将用户接乘搭乘信息转换为bean
	 * @author zhoxuuan
	 * @since V2.3.0
	 */
	@Transactional(readOnly = true)
	private UserTakeInformation convertUserTakeInformation(Object[] userTakeObjects) {
		UserTakeInformation userTakeInformation = new UserTakeInformation();
		if (userTakeObjects != null && userTakeObjects.length > 0) {
			if (userTakeObjects[0] != null) {
				userTakeInformation.setPickUpMeters(new BigDecimal(userTakeObjects[0].toString()));
			} else {
				userTakeInformation.setPickUpMeters(new BigDecimal(0));
			}
			if (userTakeObjects[1] != null) {
				userTakeInformation.setRideMeters(new BigDecimal(userTakeObjects[1].toString()));
			} else {
				userTakeInformation.setRideMeters(new BigDecimal(0));
			}
		} else {
			userTakeInformation.setPickUpMeters(new BigDecimal(0));
			userTakeInformation.setRideMeters(new BigDecimal(0));
		}
		return userTakeInformation;
	}

	/**
	 * @Title: getUserTakeImformationFromDB
	 * @Description:将用户接乘搭乘信息从数据库中读取出来
	 * @author zhouxuan
	 * @since V2.3.0
	 */
	@Transactional(readOnly = true)
	private Object[] getUserTakeImformationFromDB(String userId) {
		Object[] userTakeObjects = new Object[2];
		try {
			userTakeObjects = super.sqlQueryUnResultObj(MyOrderSQL.GET_USER_TAKE_IMFORMATION, userId);
		} catch (Exception e) {
			log.error("查询用户接乘搭乘信息失败！类：getUserTakeImformationFromDB()", e);
		}
		return userTakeObjects;
	}

	/**
	 * @Title: getMyOrderList
	 * @Description:获得我的订单
	 * @author zhouxuan
	 * @since V2.3.0
	 */
	@Transactional(readOnly = true)
	public List<MyOrder> getMyOrderList(ReqMyOrderDTO reqMyOrderDTO) {

		// 从数据库获取订单列表
		List<Object[]> orderObjects = getMyOrderListFromDB(reqMyOrderDTO);
		// 转换bean
		List<MyOrder> orderLists = orderConvertBean(orderObjects, reqMyOrderDTO);

		return orderLists;
	}

	/**
	 * 
	 * @Title: getMyDriverOrderList 
	 * @Description: 获取出租车司机历史订单
	 * @param reqMyOrderDTO 客户端请求Bean
	 * @author YHQ 
	 * @since V2.5.6
	 * @return List<MyOrder>    返回类型
	 * 
	 */
	@Transactional(readOnly = true)
	public List<MyOrder> getMyDriverOrderList(ReqMyOrderDTO reqMyOrderDTO) {

		// 从数据库获取订单列表
		List<Object[]> orderObjects = getMyDriverOrderListFromDB(reqMyOrderDTO);
		// 转换bean
		List<MyOrder> orderLists = orderConvertBean(orderObjects, reqMyOrderDTO);

		return orderLists;
	}
	
	/**
	 * 
	 * @Title: getHistoryOrder
	 * @Description: 获取我的历史订单(已完成 + 已取消)
	 * @author YHQ
	 * @since V2.5.0
	 * @return List<ResHistoryOrderDTO> 用户所有历史订单
	 * 
	 */
	@Transactional(readOnly = true)
	public List<ResHistoryOrderDTO> getHistoryOrder(ReqHistoryOrderDTO reqHistoryOrderDTO) {

		List<ResHistoryOrderDTO> orderList = new ArrayList<ResHistoryOrderDTO>();

		try {

			// 我的订单(已完成 + 已取消)(顺风车 + 出租车)
			List<ResHistoryOrderDTO> historyOrderDTOs = sqlBaseDao.listSqlToCustomBean(ResHistoryOrderDTO.class,
					MyOrderSQL.GET_HISTORY_ORDER_LIST, reqHistoryOrderDTO.getUserId(), reqHistoryOrderDTO.getUserId(),
					reqHistoryOrderDTO.getUserId(), reqHistoryOrderDTO.getUserId());

			// 我的订单(已完成 + 已取消)(专车)
			List<ResHistoryOrderDTO> specialHistoryOrderDTOs = sqlBaseDao.listSqlToCustomBean(ResHistoryOrderDTO.class,
					MyOrderSQL.GET_SPECIAL_HISTORY_ORDER_LIST, reqHistoryOrderDTO.getUserId(),
					reqHistoryOrderDTO.getUserId(), reqHistoryOrderDTO.getUserId());
			// 我的订单(已完成 + 已取消)(顺风车 + 出租车)
			if (historyOrderDTOs != null && historyOrderDTOs.size() > 0) {
				orderList.addAll(historyOrderDTOs);
			}
			if (specialHistoryOrderDTOs != null && specialHistoryOrderDTOs.size() > 0) {
				for (ResHistoryOrderDTO resHistoryOrderDTO : specialHistoryOrderDTOs) {
					Integer orderStatus = resHistoryOrderDTO.getOrderStatus();
					if (orderStatus != null && orderStatus == 5) {// 专车已完成状态为5
						resHistoryOrderDTO.setOrderStatus(4); // 接口上为4
					}
					if (orderStatus != null && orderStatus == 6) {// 专车已取消状态为6
						resHistoryOrderDTO.setOrderStatus(5); // 接口上为5
					}
					orderList.add(resHistoryOrderDTO);
				}
			}

		} catch (Exception e) {
			log.error("获取我的订单(已完成 + 已取消)", e);
		}

		// 集合重新排序
		// 我的订单是否存在
		if (orderList != null && orderList.size() > 0) {

			for (ResHistoryOrderDTO item : orderList) {
				if (item.getEndTime() == null) {
					if (item.getCancelTime() != null) {
						item.setEndTime(item.getCancelTime());
					} else {
						item.setEndTime(item.getSetOutTime());
					}
				}
			}

			if (orderList.size() >= 2) {
				// 按出发时间倒序排列所有的我的订单
				Collections.sort(orderList, new Comparator<ResHistoryOrderDTO>() {
					@Override
					public int compare(ResHistoryOrderDTO o1, ResHistoryOrderDTO o2) {
						return o2.getEndTime().compareTo(o1.getEndTime());
					}
				});
			}
			// 开始分页获取集合中的历史数据
			int startNumber = (reqHistoryOrderDTO.getPageIndex() - 1) * reqHistoryOrderDTO.getPageSize();
			int endNumber = startNumber + reqHistoryOrderDTO.getPageSize();
			if (startNumber > orderList.size()) {
				return new ArrayList<ResHistoryOrderDTO>();
			}

			if (endNumber > orderList.size()) {
				return orderList.subList(startNumber, orderList.size());
			}

			return orderList.subList(startNumber, endNumber);
		}

		return orderList;

	}

	/**
	 * 
	 * @Title: getHistoryOrderDetail
	 * @Description: 获取订单详情(已完成 + 已取消)
	 * @param reqHistoryOrderDetailDTO
	 *            历史订单客户端请求Bean
	 * @author YHQ
	 * @since V2.5.0
	 * @return List<ResHistoryOrderDetailDTO> 返回类型
	 * 
	 */
	@Transactional(readOnly = true)
	public ResHistoryOrderDetailDTO getHistoryOrderDetail(ReqHistoryOrderDetailDTO reqHistoryOrderDetailDTO) {

		// 创建存储订单详情对象
		ResHistoryOrderDetailDTO resHistoryOrderDetailDTO = new ResHistoryOrderDetailDTO();

		List<ResHistoryOrderDetailDTO> resHistoryOrderDetailDTOs = new ArrayList<ResHistoryOrderDetailDTO>();

		if (reqHistoryOrderDetailDTO.getPublishType() == 1) { // 顺风车
			resHistoryOrderDetailDTOs = sqlBaseDao.listSqlToCustomBean(ResHistoryOrderDetailDTO.class,
					MyOrderSQL.HISTORY_ORDER_DETAIL_LIST, reqHistoryOrderDetailDTO.getUserId(),
					reqHistoryOrderDetailDTO.getUserId(), reqHistoryOrderDetailDTO.getUserId(),
					reqHistoryOrderDetailDTO.getUserId(), reqHistoryOrderDetailDTO.getUserId(),
					reqHistoryOrderDetailDTO.getUserId(), reqHistoryOrderDetailDTO.getOid());
		} else if (reqHistoryOrderDetailDTO.getPublishType() == 3 
				|| reqHistoryOrderDetailDTO.getPublishType() == 4) { // 专车或一口价
			resHistoryOrderDetailDTOs = sqlBaseDao.listSqlToCustomBean(ResHistoryOrderDetailDTO.class,
					MyOrderSQL.SPECIAL_HISTORY_ORDER_DETAIL_LIST, reqHistoryOrderDetailDTO.getUserId(),
					reqHistoryOrderDetailDTO.getOid());
		}else if(reqHistoryOrderDetailDTO.getPublishType() == 2){//出租车
			resHistoryOrderDetailDTOs = sqlBaseDao.listSqlToCustomBean(ResHistoryOrderDetailDTO.class,
					MyOrderSQL.TAXI_HISTORY_ORDER_DETAIL_LIST, reqHistoryOrderDetailDTO.getUserId(),
					reqHistoryOrderDetailDTO.getOid());
		}

		// 判断是否存在订单详情
		if (resHistoryOrderDetailDTOs != null && resHistoryOrderDetailDTOs.size() > 0) {

			resHistoryOrderDetailDTO = resHistoryOrderDetailDTOs.get(0);

			if (resHistoryOrderDetailDTO.getEndTime() == null) {

				if (resHistoryOrderDetailDTO.getCancelTime() != null) {
					resHistoryOrderDetailDTO.setEndTime(resHistoryOrderDetailDTO.getCancelTime());
				} else {
					resHistoryOrderDetailDTO.setEndTime(resHistoryOrderDetailDTO.getSetOutTime());
				}

			}

			// 设置相关数据
			// 发单类型 1:顺风车 2:出租车 3:专车4:一口价
			int publishType = resHistoryOrderDetailDTO.getPublishType();
			switch (publishType) {
			case 1: // 顺风车
				if (reqHistoryOrderDetailDTO.getOrderType() == 2) {
					resHistoryOrderDetailDTO.setPlatformCost(new BigDecimal(2.0)); // 平台费
				}
				// 判断当前用户在订单中角色 乘客 和 车主 分别显示不同接数值
				if (reqHistoryOrderDetailDTO.getOrderType() == 2) { // 乘客
					resHistoryOrderDetailDTO.setOrderCost(resHistoryOrderDetailDTO.getTotalMoney());
					resHistoryOrderDetailDTO.setTotalMoney(resHistoryOrderDetailDTO.getTotalMoney().add(new BigDecimal(2)));
				} else if (reqHistoryOrderDetailDTO.getOrderType() == 1) { // 车主
					resHistoryOrderDetailDTO.setOrderCost(resHistoryOrderDetailDTO.getTotalMoney());
				}
				break;
			case 3: // 专车
			case 4: // 一口价
				// 设置时长费用
				if (resHistoryOrderDetailDTO.getDuration() != null) {
					BigDecimal druationCost = resHistoryOrderDetailDTO.getDuration().multiply(new BigDecimal(0.5));
					resHistoryOrderDetailDTO.setOrderCost(resHistoryOrderDetailDTO.getTotalMoney().add(druationCost));
					resHistoryOrderDetailDTO.setDurationCost(druationCost);
				}
				break;
			}

		}

		return resHistoryOrderDetailDTO;
	}

	/**
	 * @Title: orderConvertBean
	 * @Description:将订单object转换成bean
	 * @author zhouxuan
	 * @since V2.3.0
	 */
	@Transactional(readOnly = true)
	private List<MyOrder> orderConvertBean(List<Object[]> orderObjects, ReqMyOrderDTO reqMyOrderDTO) {
		List<MyOrder> myOrders = new ArrayList<MyOrder>();

		// 依次转换数据库结果
		for (Object[] obj : orderObjects) {
			// 临时准换对象
			MyOrder myOrder = new MyOrder();
			// 取消类型 1：司机主动取消2：乘客主动取消
			if (obj[0] != null) {
				myOrder.setCancelNumber(ToolUtil.castInteger(obj[0]));
			}
			if (obj[1] != null) {
				if (obj[1].toString().equals(reqMyOrderDTO.getUserId())) {
					myOrder.setCancelRerson(1);// 自己取消
				} else {
					myOrder.setCancelRerson(2);// 对方取消
				}
			} else {
				myOrder.setCancelRerson(3);// 自动取消
			}
			// 取消类型 1：乘客取消 2:自动取消
			if (obj[2] != null) {
				myOrder.setCancelType(ToolUtil.castInteger(obj[2]));
			}
			// 优惠金额
			if (obj[3] != null) {
				myOrder.setCouponMoney(new BigDecimal(obj[3].toString()));
			} else {
				myOrder.setCouponMoney(new BigDecimal(0));
			}
			// 下单时间
			if (obj[4] != null) {
				myOrder.setCreateTime((Date) obj[4]);
			}
			// 总里程
			if (obj[5] != null) {
				myOrder.setDistance(new BigDecimal(obj[5].toString()));
			}
			// 车主赠送积分
			if (obj[6] != null) {
				myOrder.setDriverIRcvntegral(new BigDecimal(obj[6].toString()));
			}
			// 目的地
			if (obj[7] != null) {
				myOrder.setEndAddress(obj[7].toString());
			}
			// 是否合乘 1：不合乘 2：合乘
			if (obj[8] != null) {
				myOrder.setIsCarShare(ToolUtil.castInteger(obj[8]));
			}
			// 车主是否被评价过 1：未评价 2：评价过
			if (obj[9] != null) {
				myOrder.setIsComment(ToolUtil.castInteger(obj[9]));
			}
			// 是否长途 1：普通2：长途
			if (obj[10] != null) {
				myOrder.setIsLongDistance(ToolUtil.castInteger(obj[10]));
			}
			// 留言
			if (obj[11] != null) {
				myOrder.setMessage(obj[11].toString());
			}
			// 昵称
			if (obj[12] != null) {
				myOrder.setNickName(obj[12].toString());
			}
			// 合乘人数
			if (obj[13] != null) {
				myOrder.setNumber(ToolUtil.castInteger(obj[13]));
			}
			// 订单ID
			if (obj[14] != null) {
				myOrder.setOid(obj[14].toString());
			}
			// 订单类型1:接程 2：搭程
			if (obj[15] != null && obj[23] != null) {

				Integer orderType = ToolUtil.castInteger(obj[15]);

				// 当前用户是否为下单用户(乘客)
				if ((reqMyOrderDTO.getUserId().equals(obj[23].toString()) && orderType == 2)
						|| (!reqMyOrderDTO.getUserId().equals(obj[23].toString()) && orderType == 1)) {
					myOrder.setOrderType(2); // 搭乘
				} else {
					myOrder.setOrderType(1); // 接乘
				}
			}
			// 下单类型 1:私家车 2:出租车
			if (obj[16] != null) {
				myOrder.setRegistrationType(ToolUtil.castInteger(obj[16]));
			} else {
				myOrder.setRegistrationType(1);
			}
			// 出发时间
			if (obj[17] != null) {
				myOrder.setSetOutTime(DateFormatUtil.yyyy_MM_dd_HHmmss((Date)obj[17]));
			}
			// 出发地
			if (obj[18] != null) {
				myOrder.setStartAddress(obj[18].toString());
			}
			// 金额
			if (obj[19] != null) {
				if (myOrder.getRegistrationType() == null || myOrder.getRegistrationType() == 1) { // 私家车
					myOrder.setTotalMoney(new BigDecimal(obj[19].toString()).add(new BigDecimal(2)));
					// 订单费用
					myOrder.setOrderCost(new BigDecimal(obj[19].toString()));
					// 平台费用
					myOrder.setPlatformCost(new BigDecimal(2));
				} else { // 出租车
					myOrder.setTotalMoney(new BigDecimal(obj[19].toString()));
					// 订单费用
					myOrder.setOrderCost(new BigDecimal(obj[19].toString()));
					// 平台费用
					myOrder.setPlatformCost(new BigDecimal(2));
				}
			}
			// 对方用户头像
			if (obj[20] != null) {
				myOrder.setUserAvatar(ToolUtil.imageAddress(obj[20].toString()));
			}
			// 用户级别
			if (obj[21] != null) {
				myOrder.setUserLevel(new BigDecimal(obj[21].toString()));
			}
			// 对方用户头像缩略图
			if (obj[22] != null) {
				myOrder.setUserTabloidAvatar(ToolUtil.imageAddress(obj[22].toString()));
			}
			// 订单状态
			if(obj[24] != null){
				myOrder.setOrderStatus(Integer.valueOf(obj[24].toString()));
				if(myOrder.getOrderStatus() == 4){
					myOrder.setOrderStatus(5);
				}else if(myOrder.getOrderStatus() == 5){
					myOrder.setOrderStatus(6);
				}
			}
			myOrders.add(myOrder);
		}
		return myOrders;
	}

	/**
	 * @Title: getMyOrderListFromDB
	 * @Description:从数据看获取我的订单信息
	 * @author zhouxuan
	 * @since V2.3.0
	 */
	@Transactional(readOnly = true)
	private List<Object[]> getMyOrderListFromDB(ReqMyOrderDTO reqMyOrderDTO) {
		// 创建对象集
		List<Object[]> orderObjects = new ArrayList<Object[]>();
		try {
			orderObjects = super.listSqlObj(MyOrderSQL.GET_MY_ORDER_LIST, reqMyOrderDTO.getUserId(),
					 reqMyOrderDTO.getUserId(), reqMyOrderDTO.getUserId(),
					(reqMyOrderDTO.getPageIndex() - 1) * reqMyOrderDTO.getPageSize(), reqMyOrderDTO.getPageSize());
		} catch (Exception e) {
			log.error("获取我的订单列表失败！类：getMyOrderListFromDB()", e);
		}
		return orderObjects;
	}


	/**
	 * @Title: getMyOrderListFromDB
	 * @Description:从数据看获取我的订单信息
	 * @author zhouxuan
	 * @since V2.3.0
	 */
	@Transactional(readOnly = true)
	private List<Object[]> getMyDriverOrderListFromDB(ReqMyOrderDTO reqMyOrderDTO) {
		// 创建对象集
		List<Object[]> orderObjects = new ArrayList<Object[]>();
		try {
			orderObjects = super.listSqlObj(MyOrderSQL.GET_MY_DRIVER_ORDER_LIST, reqMyOrderDTO.getUserId(),
					reqMyOrderDTO.getUserId(), reqMyOrderDTO.getUserId(),
					(reqMyOrderDTO.getPageIndex() - 1) * reqMyOrderDTO.getPageSize(), reqMyOrderDTO.getPageSize());
		} catch (Exception e) {
			log.error("获取我的订单列表失败！类：getMyOrderListFromDB()", e);
		}
		return orderObjects;
	}
	
	/**
	 * @Description:获取乘客的专车订单
	 * @param userId
	 *            用户id
	 * @author fengshuonan
	 * @since 2.4
	 */
	@Override
	@Transactional(readOnly = true)
	public List<SpeCusOrdInfoResult> getCustomerSpecialOrder(String userId) {

		List<SpeCusOrdInfoResult> orderts = null;

		try {
			orderts = this.sqlBaseDao.listSqlToCustomBean(SpeCusOrdInfoResult.class,
					MyOrderSQL.getCustomerSpecialOrderInfo(2), userId);
		} catch (Exception e) {
			log.error("获取乘客的专车订单错误！GetMyOrderDaoImpl ： getCustomerSpecialOrder()", e);
			return null;
		}

		// 把所有的已完成和未完成订单放到一起
		List<SpeCusOrdInfoResult> newOrders = new ArrayList<SpeCusOrdInfoResult>();
		if (orderts != null && orderts.size() > 0) {
			for (SpeCusOrdInfoResult result : orderts) {
				result.generateImageAddress();
				newOrders.add(result);
			}
		}

		// 按时间倒序排序
		Collections.sort(newOrders, new Comparator<SpeCusOrdInfoResult>() {
			@Override
			public int compare(SpeCusOrdInfoResult o1, SpeCusOrdInfoResult o2) {
				return o2.getSetOutTime().compareTo(o1.getSetOutTime());
			}
		});

		return newOrders;
	}

	/**
	 * @Description:获取用户id通过手机号
	 * @param phone
	 *            手机号
	 * @author fengshuonan
	 * @return String 用户id
	 * @since 2.4
	 */
	@Override
	@Transactional(readOnly = true)
	public String getUserIdByPhone(String phone) {

		try {
			UserLogin userlogin = this.criteriaBaseDao.queryCriteriaListUnique(UserLogin.class,
					Restrictions.eq("userName", phone));
			if (userlogin != null) {
				return userlogin.getUid();
			} else {
				return null;
			}
		} catch (Exception e) {
			log.error("获取用户id出现错误！GetMyOrderDaoImpl ： getUserIdByPhone()", e);
			return null;
		}
	}

	/**
	 * @Description:取消专车订单
	 * @param orderId
	 *            订单id
	 * @author fengshuonan
	 * @return boolean true 成功 fasle 失败
	 * @since 2.4
	 */
	@Override
	@Transactional(propagation = Propagation.REQUIRED)
	public Boolean cancelSpecialOrder(String orderId) {

		try {
			UserspecialorderT userspecialorderT = this.criteriaBaseDao.getById(orderId, UserspecialorderT.class);

			if (userspecialorderT == null) {
				return false;
			}

			// 设置为乘客取消并且状态为取消状态
			userspecialorderT.setCancelType(1);
			userspecialorderT.setOrderStatus(6);

			// 订单放到正式库
			Userspecialorder userspecialorder = new Userspecialorder();
			BeanUtils.copyProperties(userspecialorderT, userspecialorder);
			userspecialorder.setIsComment(1);// 未评价

			this.baseDaoX.save(userspecialorder);
			this.baseDaoX.delete(userspecialorderT);

			return true;
		} catch (Exception e) {
			log.error("获取专车订单出错！GetMyOrderDaoImpl : cancelSpecialOrder()", e);
			return false;
		}
	}
}
